﻿using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient.UI
{
	// Token: 0x02001888 RID: 6280
	internal class BattleIndicateHandler : DlgHandlerBase
	{
		// Token: 0x06010551 RID: 66897 RVA: 0x003F56D8 File Offset: 0x003F38D8
		protected override void Init()
		{
			base.Init();
			this._campEntity = XSingleton<XEntityMgr>.singleton.Player;
			bool flag = DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsLoaded();
			if (flag)
			{
				this.InitTeamIndicate();
			}
			this.MiniMapSize = new Vector2(this.BASESIZE, this.BASESIZE);
			this._staticMap = XSingleton<XSceneMgr>.singleton.GetSceneStaticMiniMapCenter(XSingleton<XScene>.singleton.SceneID, out this._referencePos);
			this._outSize = Vector2.one;
			this.SetMiniMapSize(XSingleton<XSceneMgr>.singleton.GetSceneMiniMapOutSize(XSingleton<XScene>.singleton.SceneID), 0f);
			this.InitMiniMap();
			this._heroBattleDepth_O = 200;
			this._heroBattleDepth_A = 100;
			this.MaxDisplayNum = XSingleton<XGlobalConfig>.singleton.GetInt("MaxEnmeyIndicatorDisplayNum");
		}

		// Token: 0x06010552 RID: 66898 RVA: 0x003F57A4 File Offset: 0x003F39A4
		public void SetMiniMapSize(Vector2 size, float scale = 0f)
		{
			bool flag = size != this._outSize;
			if (flag)
			{
				this.SetMiniMapOutSize(Vector2.one);
				this.SetMiniMapOutSize(size);
			}
			bool flag2 = scale > 0f;
			if (flag2)
			{
				this.MiniMapScale = scale;
			}
		}

		// Token: 0x06010553 RID: 66899 RVA: 0x003F57EC File Offset: 0x003F39EC
		private void SetMiniMapOutSize(Vector2 size)
		{
			Vector2 outSize = this._outSize;
			this._outSize = size;
			this.MiniMapSize = new Vector2(this.BASESIZE * this._outSize.x, this.BASESIZE * this._outSize.y);
			IXUISprite ixuisprite = base.PanelObject.transform.FindChild("Bg/MapBg").GetComponent("XUISprite") as IXUISprite;
			ixuisprite.spriteWidth = (int)((float)ixuisprite.spriteWidth / outSize.x * this._outSize.x);
			ixuisprite.spriteHeight = (int)((float)ixuisprite.spriteHeight / outSize.y * this._outSize.y);
			IXUIPanel ixuipanel = base.PanelObject.transform.FindChild("MiniMap").GetComponent("XUIPanel") as IXUIPanel;
			Vector4 clipRange = ixuipanel.ClipRange;
			float num = clipRange.z;
			clipRange.z = clipRange.z / outSize.x * this._outSize.x;
			clipRange.x = -(clipRange.z - num) / 2f;
			num = clipRange.w;
			clipRange.w = clipRange.w / outSize.y * this._outSize.y;
			clipRange.y = -(clipRange.w - num) / 2f;
			ixuipanel.ClipRange = clipRange;
			IXUISprite ixuisprite2 = base.PanelObject.transform.FindChild("MiniMap/Bg").GetComponent("XUISprite") as IXUISprite;
			Vector3 localPosition = ixuisprite2.transform.localPosition;
			num = (float)ixuisprite2.spriteWidth;
			ixuisprite2.spriteWidth = (int)((float)ixuisprite2.spriteWidth / outSize.x * this._outSize.x);
			localPosition.x = -((float)ixuisprite2.spriteWidth - num) / 2f;
			num = (float)ixuisprite2.spriteHeight;
			ixuisprite2.spriteHeight = (int)((float)ixuisprite2.spriteHeight / outSize.y * this._outSize.y);
			localPosition.y = -((float)ixuisprite2.spriteHeight - num) / 2f;
			ixuisprite2.transform.localPosition = localPosition;
			IXUISprite ixuisprite3 = base.PanelObject.transform.FindChild("Bg/NameBg").GetComponent("XUISprite") as IXUISprite;
			num = (float)ixuisprite3.spriteWidth;
			ixuisprite3.spriteWidth = (int)((float)ixuisprite3.spriteWidth / outSize.x * this._outSize.x);
			localPosition = ixuisprite3.transform.localPosition;
			ixuisprite3.transform.localPosition = new Vector3(-((float)ixuisprite3.spriteWidth - num) / 2f, localPosition.y);
			IXUILabel ixuilabel = base.PanelObject.transform.FindChild("Bg/Name").GetComponent("XUILabel") as IXUILabel;
			num = (float)ixuilabel.spriteWidth;
			ixuilabel.spriteWidth = (int)((float)ixuilabel.spriteWidth / outSize.x * this._outSize.x);
			localPosition = ixuilabel.gameObject.transform.localPosition;
			ixuilabel.gameObject.transform.localPosition = new Vector3(-((float)ixuilabel.spriteWidth - num) / 2f, localPosition.y);
		}

		// Token: 0x06010554 RID: 66900 RVA: 0x003F5B44 File Offset: 0x003F3D44
		public override void OnUnload()
		{
			foreach (MiniMapElement miniMapElement in this.m_MiniMapElements.Values)
			{
				this.DestroyFx(miniMapElement.notice);
			}
			foreach (MiniMapElement miniMapElement2 in this.m_MiniMapDoodadDic.Values)
			{
				this.DestroyFx(miniMapElement2.notice);
			}
			foreach (MiniMapElement miniMapElement3 in this.m_MiniMapFxDic.Values)
			{
				this.DestroyFx(miniMapElement3.notice);
			}
			foreach (MiniMapElement miniMapElement4 in this.m_MiniMapPicDic.Values)
			{
				this.DestroyFx(miniMapElement4.notice);
			}
			this.m_MiniMapDoor.Clear();
			this.m_MiniMapElements.Clear();
			this.m_MiniMapBuff.Clear();
			this.m_MiniMapDoodadDic.Clear();
			this.m_MiniMapFx.Clear();
			this.m_MiniMapPic.Clear();
			this.m_MiniMapFxDic.Clear();
			this.m_MiniMapPicDic.Clear();
			this.m_MiniMapElementPool.ReturnAll(false);
			this.m_MiniMap.SetTexturePath("");
			base.OnUnload();
		}

		// Token: 0x06010555 RID: 66901 RVA: 0x003F5D28 File Offset: 0x003F3F28
		private void InitTeamIndicate()
		{
			this._Half_V_Fov = 0.017453292f * (XSingleton<XScene>.singleton.GameCamera.UnityCamera.fieldOfView * 0.5f);
			float num = (float)XSingleton<XGameUI>.singleton.Base_UI_Width / (float)XSingleton<XGameUI>.singleton.Base_UI_Height;
			this._Half_H_Fov = (float)Math.Atan(Math.Tan((double)this._Half_V_Fov) * (double)num) * 0.95f;
			this._tan_half_H_fov = (float)Math.Tan((double)this._Half_H_Fov);
			this._tan_half_V_fov = (float)Math.Tan((double)this._Half_V_Fov);
			this._sqr_tan_half_V_fov = this._tan_half_V_fov * this._tan_half_V_fov;
			Transform transform = base.PanelObject.transform.FindChild("EnemyIndicate");
			this.m_TeamIndicatePool.SetupPool(transform.parent.gameObject, transform.gameObject, 10U, true);
			this.m_Direction = base.PanelObject.transform.FindChild("Direction");
			this.m_DirectPos = this.m_Direction.localPosition;
			this.m_Direction.gameObject.transform.localPosition = XGameUI.Far_Far_Away;
			this.m_EntityIndicates.Clear();
			this.m_IndicatesList.Clear();
			this.m_TeamIndicatePool.ReturnAll(false);
		}

		// Token: 0x06010556 RID: 66902 RVA: 0x003F5E70 File Offset: 0x003F4070
		private void InitMiniMap()
		{
			this.m_MiniMapCamera = base.PanelObject.transform.Find("MiniMap/Bg/Rotation/Camera");
			this.m_MiniMapCamera.gameObject.SetActive(!this._staticMap);
			Transform transform = base.PanelObject.transform.FindChild("MiniMap/Bg/Rotation/Element");
			this.m_MiniMapElementPool.SetupPool(transform.parent.gameObject, transform.gameObject, 20U, true);
			this.m_MiniMapRotation = base.PanelObject.transform.FindChild("MiniMap/Bg/Rotation");
			this.m_MiniMap = (base.PanelObject.transform.FindChild("MiniMap/Bg/Rotation/Map").GetComponent("XUITexture") as IXUITexture);
			this.MiniMapScale = (float)XSingleton<XGlobalConfig>.singleton.GetInt("MiniMapScale") / 10f;
			this.MiniMapInit();
		}

		// Token: 0x06010557 RID: 66903 RVA: 0x003F5F54 File Offset: 0x003F4154
		private void MiniMapInit()
		{
			this.m_MiniMapDoor.Clear();
			this.m_MiniMapElements.Clear();
			this.m_MiniMapBuff.Clear();
			this.m_MiniMapDoodadDic.Clear();
			this.m_MiniMapFx.Clear();
			this.m_MiniMapPic.Clear();
			this.m_MiniMapFxDic.Clear();
			this.m_MiniMapPicDic.Clear();
			this.m_MiniMapElementPool.ReturnAll(false);
			this.MiniMapAdd(XSingleton<XEntityMgr>.singleton.Player);
			uint sceneID = XSingleton<XScene>.singleton.SceneID;
			string sceneMiniMap = XSingleton<XSceneMgr>.singleton.GetSceneMiniMap(sceneID);
			bool flag = !string.IsNullOrEmpty(sceneMiniMap);
			if (flag)
			{
				this.m_MiniMap.SetTexturePath("atlas/UI/Battle/minimap/" + sceneMiniMap);
			}
			short[] sceneMiniMapSize = XSingleton<XSceneMgr>.singleton.GetSceneMiniMapSize(sceneID);
			bool flag2 = sceneMiniMapSize != null;
			if (flag2)
			{
				bool flag3 = sceneMiniMapSize.Length > 2;
				if (flag3)
				{
					this.MiniMapScale = (float)sceneMiniMapSize[2] / 10f;
				}
				this.MapSizeInTable = new Vector2((float)sceneMiniMapSize[0], (float)sceneMiniMapSize[1]);
				this.m_MiniMap.spriteWidth = (int)(this.MapSizeInTable.x * this.MiniMapScale);
				this.m_MiniMap.spriteHeight = (int)(this.MapSizeInTable.y * this.MiniMapScale);
			}
			this.m_MiniMapRotation.transform.eulerAngles = new Vector3(0f, 0f, (float)XSingleton<XSceneMgr>.singleton.GetSceneMiniMapRotation(sceneID));
			BattleIndicateHandler._hide_minimap_opponent = false;
		}

		// Token: 0x06010558 RID: 66904 RVA: 0x003F60D4 File Offset: 0x003F42D4
		public void SetMiniMapRotation(float rotation)
		{
			bool flag = XSingleton<XSceneMgr>.singleton.GetSceneMiniMapRotation(XSingleton<XScene>.singleton.SceneID) < 0;
			if (flag)
			{
				bool flag2 = this.m_MiniMapRotation != null;
				if (flag2)
				{
					this.m_MiniMapRotation.transform.eulerAngles = new Vector3(0f, 0f, rotation);
				}
			}
		}

		// Token: 0x06010559 RID: 66905 RVA: 0x003F6130 File Offset: 0x003F4330
		public override void OnUpdate()
		{
			base.OnUpdate();
			bool flag = XSingleton<XEntityMgr>.singleton.Player == null;
			if (!flag)
			{
				bool flag2 = !this._staticMap;
				if (flag2)
				{
					this._referencePos = XSingleton<XEntityMgr>.singleton.Player.EngineObject.Position;
				}
				bool flag3 = DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsLoaded();
				if (flag3)
				{
					this.m_ValidSet.Clear();
					this.UpdateTeamIndicate();
					this.UpdateEnemyIndicate();
					this.UpdateDirection();
					bool flag4 = this.m_IndicatesList.Count != this.m_ValidSet.Count;
					if (flag4)
					{
						for (int i = this.m_IndicatesList.Count - 1; i >= 0; i--)
						{
							bool flag5 = !this.m_ValidSet.Contains(this.m_IndicatesList[i].id);
							if (flag5)
							{
								BattleIndicator battleIndicator = this.m_IndicatesList[i];
								this.m_TeamIndicatePool.ReturnInstance(battleIndicator.sp.gameObject, false);
								this.m_EntityIndicates.Remove(battleIndicator.id);
								this.m_IndicatesList.RemoveAt(i);
							}
						}
					}
				}
				this.UpdateMiniMap();
			}
		}

		// Token: 0x0601055A RID: 66906 RVA: 0x003F627C File Offset: 0x003F447C
		private void UpdateMiniMap()
		{
			bool flag = this._campEntity == null;
			if (!flag)
			{
				this.m_MiniMap.spriteWidth = (int)(this.MapSizeInTable.x * this.MiniMapScale);
				this.m_MiniMap.spriteHeight = (int)(this.MapSizeInTable.y * this.MiniMapScale);
				MiniMapElement element;
				bool flag2 = this.m_MiniMapElements.TryGetValue(this._campEntity.ID, out element);
				if (flag2)
				{
					this.SetupMiniMapElement(this._campEntity, element, false);
					this.m_MiniMap.gameObject.transform.localPosition = new Vector3(-this._referencePos.x, -this._referencePos.z) * this.MiniMapScale;
				}
				bool flag3 = !this._staticMap && this.m_MiniMapCamera != null && XSingleton<XScene>.singleton.GameCamera.UnityCamera != null;
				if (flag3)
				{
					this.m_MiniMapCamera.localEulerAngles = new Vector3(0f, 0f, -XSingleton<XScene>.singleton.GameCamera.UnityCamera.transform.eulerAngles.y);
				}
				List<XEntity> opponent = XSingleton<XEntityMgr>.singleton.GetOpponent(this._campEntity);
				for (int i = 0; i < opponent.Count; i++)
				{
					bool flag4 = this.m_MiniMapElements.TryGetValue(opponent[i].ID, out element);
					if (flag4)
					{
						this.SetupMiniMapElement(opponent[i], element, BattleIndicateHandler._hide_minimap_opponent || !opponent[i].IsVisible);
					}
				}
				List<XEntity> ally = XSingleton<XEntityMgr>.singleton.GetAlly(this._campEntity);
				for (int j = 0; j < ally.Count; j++)
				{
					bool flag5 = this.m_MiniMapElements.TryGetValue(ally[j].ID, out element);
					if (flag5)
					{
						this.SetupMiniMapElement(ally[j], element, false);
					}
				}
				for (int k = 0; k < this.m_MiniMapDoor.Count; k++)
				{
					this.SetupMiniMapStatic(this.m_MiniMapDoor[k]);
				}
				for (int l = 0; l < this.m_MiniMapBuff.Count; l++)
				{
					this.SetupMiniMapStatic(this.m_MiniMapBuff[l]);
				}
				for (int m = 0; m < this.m_MiniMapFx.Count; m++)
				{
					this.SetupMiniMapFxStatic(this.m_MiniMapFx[m]);
				}
				for (int n = 0; n < this.m_MiniMapPic.Count; n++)
				{
					this.SetupMiniMapFxStatic(this.m_MiniMapPic[n]);
				}
			}
		}

		// Token: 0x0601055B RID: 66907 RVA: 0x003F656C File Offset: 0x003F476C
		private void SetupMiniMapElement(XEntity entity, MiniMapElement element, bool hide = false)
		{
			bool deprecated = entity.Deprecated;
			if (deprecated)
			{
				this.m_MiniMapElements.Remove(entity.ID);
				this.DestroyFx(element.notice);
				element.notice = null;
				this.m_MiniMapElementPool.ReturnInstance(element.sp.gameObject, false);
			}
			else
			{
				Vector3 position = entity.EngineObject.Position;
				float num = position.x - this._referencePos.x;
				float num2 = position.z - this._referencePos.z;
				element.transform.localPosition = new Vector3(num, num2) * this.MiniMapScale;
				element.transform.parent = element.transform.parent.parent;
				bool flag = element.transform.localPosition.x > this.MiniMapSize.x;
				if (flag)
				{
					num = this.MiniMapSize.x;
				}
				else
				{
					bool flag2 = element.transform.localPosition.x < -this.MiniMapSize.x;
					if (flag2)
					{
						num = -this.MiniMapSize.x;
					}
					else
					{
						num = element.transform.localPosition.x;
					}
				}
				bool flag3 = element.transform.localPosition.y > this.MiniMapSize.y;
				if (flag3)
				{
					num2 = this.MiniMapSize.y;
				}
				else
				{
					bool flag4 = element.transform.localPosition.y < -this.MiniMapSize.y;
					if (flag4)
					{
						num2 = -this.MiniMapSize.y;
					}
					else
					{
						num2 = element.transform.localPosition.y;
					}
				}
				element.transform.localPosition = new Vector3(num, num2);
				element.transform.parent = this.m_MiniMapRotation;
				element.sp.transform.localEulerAngles = -this.m_MiniMapRotation.transform.eulerAngles;
				float alpha = 1f;
				bool isPlayer = entity.IsPlayer;
				if (!isPlayer)
				{
					bool isDead = entity.IsDead;
					if (isDead)
					{
						alpha = 0f;
					}
				}
				if (hide)
				{
					alpha = 0f;
				}
				element.sp.SetAlpha(alpha);
			}
		}

		// Token: 0x0601055C RID: 66908 RVA: 0x003F67B0 File Offset: 0x003F49B0
		private void SetupMiniMapStatic(MiniMapElement element)
		{
			element.sp.transform.localPosition = new Vector3(element.transform.position.x - this._referencePos.x, element.transform.position.z - this._referencePos.z) * this.MiniMapScale;
			element.sp.transform.localEulerAngles = -this.m_MiniMapRotation.transform.eulerAngles;
		}

		// Token: 0x0601055D RID: 66909 RVA: 0x003F6840 File Offset: 0x003F4A40
		private void SetupMiniMapFxStatic(MiniMapElement element)
		{
			element.sp.transform.localPosition = new Vector3(element.pos.x - this._referencePos.x, element.pos.z - this._referencePos.z) * this.MiniMapScale;
		}

		// Token: 0x0601055E RID: 66910 RVA: 0x003F68A0 File Offset: 0x003F4AA0
		private void SetupMiniMapPicStatic(MiniMapElement element)
		{
			element.sp.transform.localPosition = new Vector3(element.pos.x - this._referencePos.x, element.pos.z - this._referencePos.z) * this.MiniMapScale;
		}

		// Token: 0x0601055F RID: 66911 RVA: 0x003F6900 File Offset: 0x003F4B00
		public void DelTeamIndicate(ulong uid)
		{
			BattleIndicator battleIndicator;
			bool flag = this.m_EntityIndicates.TryGetValue(uid, out battleIndicator);
			if (flag)
			{
				this.m_TeamIndicatePool.ReturnInstance(battleIndicator.sp.gameObject, false);
				this.m_EntityIndicates.Remove(uid);
				this.m_IndicatesList.Remove(battleIndicator);
			}
		}

		// Token: 0x06010560 RID: 66912 RVA: 0x003F6954 File Offset: 0x003F4B54
		protected void UpdateTeamIndicate()
		{
			bool flag = XSingleton<XScene>.singleton.SceneData == null || XSingleton<XScene>.singleton.SceneData.HideTeamIndicate;
			if (!flag)
			{
				List<XEntity> ally = XSingleton<XEntityMgr>.singleton.GetAlly(this._campEntity);
				for (int i = 0; i < ally.Count; i++)
				{
					bool flag2 = ally[i] == XSingleton<XEntityMgr>.singleton.Player;
					if (!flag2)
					{
						bool flag3 = !ally[i].IsRole;
						if (!flag3)
						{
							BattleIndicator bi;
							bool flag4 = !this.m_EntityIndicates.TryGetValue(ally[i].ID, out bi);
							if (flag4)
							{
								this.CreateEntityIndicate(out bi, ally[i], true);
							}
							bool flag5 = !XEntity.ValideEntity(ally[i]);
							if (!flag5)
							{
								this.m_ValidSet.Add(ally[i].ID);
								this.ShowIndicatePosition(bi, ally[i], true);
							}
						}
					}
				}
			}
		}

		// Token: 0x06010561 RID: 66913 RVA: 0x003F6A64 File Offset: 0x003F4C64
		protected void UpdateEnemyIndicate()
		{
			List<XEntity> opponent = XSingleton<XEntityMgr>.singleton.GetOpponent(this._campEntity);
			this.m_ShouldShowEnemyIndex.Clear();
			for (int i = 0; i < opponent.Count; i++)
			{
				bool flag = !opponent[i].IsEnemy;
				if (!flag)
				{
					bool isPuppet = opponent[i].IsPuppet;
					if (!isPuppet)
					{
						bool flag2 = XSingleton<XGame>.singleton.SyncMode && !opponent[i].IsServerFighting;
						if (!flag2)
						{
							bool flag3 = !XSingleton<XGame>.singleton.SyncMode && !opponent[i].IsFighting;
							if (!flag3)
							{
								this.m_ShouldShowEnemyIndex.Add(i);
							}
						}
					}
				}
			}
			bool flag4 = this.m_ShouldShowEnemyIndex.Count > this.MaxDisplayNum;
			if (flag4)
			{
				for (int j = 0; j < this.m_ShouldShowEnemyIndex.Count; j++)
				{
					BattleIndicator battleIndicator;
					bool flag5 = this.m_EntityIndicates.TryGetValue(opponent[this.m_ShouldShowEnemyIndex[j]].ID, out battleIndicator);
					if (flag5)
					{
						this.m_TeamIndicatePool.ReturnInstance(battleIndicator.sp.gameObject, false);
						this.m_EntityIndicates.Remove(opponent[this.m_ShouldShowEnemyIndex[j]].ID);
					}
				}
			}
			else
			{
				for (int k = 0; k < this.m_ShouldShowEnemyIndex.Count; k++)
				{
					int index = this.m_ShouldShowEnemyIndex[k];
					bool flag6 = XEntity.ValideEntity(opponent[index]);
					bool flag7 = !flag6;
					BattleIndicator battleIndicator;
					bool flag8 = !this.m_EntityIndicates.TryGetValue(opponent[index].ID, out battleIndicator);
					if (flag8)
					{
						bool flag9 = !flag7;
						if (flag9)
						{
							this.CreateEntityIndicate(out battleIndicator, opponent[index], false);
						}
						else
						{
							flag7 = false;
						}
					}
					bool flag10 = flag7;
					if (!flag10)
					{
						bool flag11 = flag6;
						if (flag11)
						{
							this.ShowIndicatePosition(battleIndicator, opponent[index], false);
							this.m_ValidSet.Add(opponent[index].ID);
						}
					}
				}
			}
		}

		// Token: 0x06010562 RID: 66914 RVA: 0x003F6CB4 File Offset: 0x003F4EB4
		protected void CreateEntityIndicate(out BattleIndicator bi, XEntity e, bool IsTeamMember)
		{
			GameObject gameObject = this.m_TeamIndicatePool.FetchGameObject(false);
			IXUISprite ixuisprite = gameObject.GetComponent("XUISprite") as IXUISprite;
			bi = default(BattleIndicator);
			bi.id = e.ID;
			bi.go = gameObject;
			bi.sp = ixuisprite;
			bi.arrow = bi.go.transform.FindChild("arrow");
			bi.leader = (bi.go.transform.FindChild("leader").GetComponent("XUISprite") as IXUISprite);
			bi.xGameObject = e.EngineObject;
			this.m_EntityIndicates.Add(e.ID, bi);
			this.m_IndicatesList.Add(bi);
			if (IsTeamMember)
			{
				string teamIndicateAvatar = XSingleton<XProfessionSkillMgr>.singleton.GetTeamIndicateAvatar(e.TypeID % 10U);
				ixuisprite.SetSprite(teamIndicateAvatar);
			}
			else
			{
				ixuisprite.SetSprite("monster_00");
			}
			bool flag = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_PVP;
			if (flag)
			{
				XBattleCaptainPVPDocument specificDocument = XDocuments.GetSpecificDocument<XBattleCaptainPVPDocument>(XBattleCaptainPVPDocument.uuID);
				bool flag2 = e.ID == specificDocument.MyPosition(false);
				bi.leader.SetAlpha((float)(flag2 ? 1 : 0));
			}
			else
			{
				bi.leader.SetAlpha(0f);
			}
		}

		// Token: 0x06010563 RID: 66915 RVA: 0x003F6E10 File Offset: 0x003F5010
		protected void ShowIndicatePosition(BattleIndicator bi, XEntity e, bool IsTeamMember)
		{
			bool flag = bi.xGameObject == null || XSingleton<XCutScene>.singleton.IsPlaying;
			if (flag)
			{
				bi.sp.gameObject.transform.localPosition = Vector3.one * (float)XGameUI._far_far_away;
			}
			else
			{
				Vector3 position = e.EngineObject.Position;
				Camera unityCamera = XSingleton<XScene>.singleton.GameCamera.UnityCamera;
				Vector3 vector = XSingleton<XEntityMgr>.singleton.Player.EngineObject.Position - position;
				bool isVisible = bi.xGameObject.IsVisible;
				if (isVisible)
				{
					if (IsTeamMember)
					{
						float num = float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("TeamIndicateDistance"));
						bool flag2 = vector.sqrMagnitude < num * num;
						if (flag2)
						{
							bi.sp.gameObject.transform.localPosition = Vector3.one * (float)XGameUI._far_far_away;
						}
						else
						{
							float num2 = e.Height + 0.6f;
							Vector3 vector2;
							vector2 = new Vector3(position.x, position.y + num2, position.z);
							Vector3 vector3 = unityCamera.WorldToViewportPoint(vector2);
							bi.sp.SetAlpha(1f);
							bi.sp.gameObject.transform.position = XSingleton<XGameUI>.singleton.UICamera.ViewportToWorldPoint(vector3);
							vector3 = bi.sp.gameObject.transform.localPosition;
							vector3.x = (float)Mathf.FloorToInt(vector3.x);
							vector3.y = (float)Mathf.FloorToInt(vector3.y);
							vector3.z = 0f;
							bi.sp.gameObject.transform.localPosition = vector3;
						}
					}
					else
					{
						bi.sp.SetAlpha(0f);
					}
				}
				else
				{
					int num3 = XSingleton<XGameUI>.singleton.Base_UI_Width / 2;
					int num4 = XSingleton<XGameUI>.singleton.Base_UI_Height / 2;
					Vector3 normalized = unityCamera.transform.forward.normalized;
					Vector3 normalized2 = unityCamera.transform.right.normalized;
					Vector3 vector4 = position - unityCamera.transform.position;
					Vector3 vector5 = position - normalized2 * Vector3.Dot(normalized2, vector4);
					Vector3 vector6 = vector5 - unityCamera.transform.position;
					Vector3 vector7 = normalized * Vector3.Dot(normalized, vector6);
					Vector3 vector8 = vector6 - vector7;
					float num5 = vector8.sqrMagnitude / vector7.sqrMagnitude;
					bool flag3 = Vector3.Dot(vector8, unityCamera.transform.up) > 0f || num5 < this._sqr_tan_half_V_fov;
					if (flag3)
					{
						vector.Set(vector.x, 0f, vector.z);
						Vector3 vector9;
						vector9 = new Vector3(unityCamera.transform.forward.x, 0f, unityCamera.transform.forward.z);
						float num6 = 0.017453292f * Vector3.Angle(vector, vector9);
						bool flag4 = !XSingleton<XCommon>.singleton.Clockwise(vector, vector9);
						if (flag4)
						{
							num6 = -num6;
						}
						float num7 = (float)Math.Tan((double)num6) / this._tan_half_H_fov * (float)XSingleton<XGameUI>.singleton.Base_UI_Width * 0.5f;
						bool flag5 = num6 >= this._Half_H_Fov;
						if (flag5)
						{
							float num8 = num7 - (float)num3;
							float num9 = num8 * (float)num4 / num7;
							num9 = Mathf.Clamp(num9, 0f, (float)XSingleton<XGameUI>.singleton.Base_UI_Height);
							bi.go.transform.localPosition = new Vector3((float)(num3 - this.m_TeamIndicatePool.TplWidth / 2), (float)(-(float)num4) + num9, 0f);
							bi.arrow.transform.localRotation = Quaternion.identity;
							bi.arrow.transform.Rotate(0f, 0f, 90f);
							bool flag6 = num9 < 260f;
							if (flag6)
							{
								bi.sp.SetAlpha(0.5f);
							}
							else
							{
								bi.sp.SetAlpha(1f);
							}
						}
						else
						{
							float num10 = -num7 - (float)num3;
							float num11 = num10 * (float)num4 / -num7;
							num11 = Mathf.Clamp(num11, (float)(this.m_TeamIndicatePool.TplHeight / 2), (float)(XSingleton<XGameUI>.singleton.Base_UI_Height - this.m_TeamIndicatePool.TplHeight / 2));
							bi.go.transform.localPosition = new Vector3((float)(-(float)num3 + this.m_TeamIndicatePool.TplWidth / 2), (float)(-(float)num4) + num11, 0f);
							bi.arrow.transform.localRotation = Quaternion.identity;
							bi.arrow.transform.Rotate(0f, 0f, -90f);
							bi.sp.SetAlpha(1f);
						}
					}
					else
					{
						vector.Set(vector.x, 0f, vector.z);
						Vector3 vector10;
						vector10 = new Vector3(unityCamera.transform.forward.x, 0f, unityCamera.transform.forward.z);
						float num12 = 0.017453292f * Vector3.Angle(vector, vector10);
						bool flag7 = !XSingleton<XCommon>.singleton.Clockwise(vector, vector10);
						if (flag7)
						{
							num12 = -num12;
						}
						float num13 = (float)Math.Tan((double)num12) / this._tan_half_H_fov * (float)XSingleton<XGameUI>.singleton.Base_UI_Width * 0.5f;
						bool flag8 = num12 <= this._Half_H_Fov && num12 >= -this._Half_H_Fov;
						if (flag8)
						{
							num13 = Mathf.Clamp(num13, (float)(-(float)num3 + this.m_TeamIndicatePool.TplWidth / 2), (float)(num3 - this.m_TeamIndicatePool.TplWidth / 2));
							bi.go.transform.localPosition = new Vector3(num13, (float)(-(float)num4 + this.m_TeamIndicatePool.TplHeight / 2), 0f);
							bi.arrow.transform.localRotation = Quaternion.identity;
							bool flag9 = num13 > 165f;
							if (flag9)
							{
								bi.sp.SetAlpha(0.5f);
							}
							else
							{
								bi.sp.SetAlpha(1f);
							}
						}
						else
						{
							bool flag10 = num12 > this._Half_H_Fov;
							if (flag10)
							{
								float num14 = num13 - (float)num3;
								float num15 = num14 * (float)num4 / num13;
								num15 = Mathf.Clamp(num15, 0f, (float)XSingleton<XGameUI>.singleton.Base_UI_Height);
								bi.go.transform.localPosition = new Vector3((float)(num3 - this.m_TeamIndicatePool.TplWidth / 2), (float)(-(float)num4) + num15, 0f);
								bi.arrow.transform.localRotation = Quaternion.identity;
								bi.arrow.transform.Rotate(0f, 0f, 90f);
								bool flag11 = num15 < 260f;
								if (flag11)
								{
									bi.sp.SetAlpha(0.5f);
								}
								else
								{
									bi.sp.SetAlpha(1f);
								}
							}
							else
							{
								bool flag12 = num12 < this._Half_H_Fov;
								if (flag12)
								{
									float num16 = -num13 - (float)num3;
									float num17 = num16 * (float)num4 / -num13;
									num17 = Mathf.Clamp(num17, (float)(this.m_TeamIndicatePool.TplHeight / 2), (float)(XSingleton<XGameUI>.singleton.Base_UI_Height - this.m_TeamIndicatePool.TplHeight / 2));
									bi.go.transform.localPosition = new Vector3((float)(-(float)num3 + this.m_TeamIndicatePool.TplWidth / 2), (float)(-(float)num4) + num17, 0f);
									bi.arrow.transform.localRotation = Quaternion.identity;
									bi.arrow.transform.Rotate(0f, 0f, -90f);
									bi.sp.SetAlpha(1f);
								}
							}
						}
					}
				}
			}
		}

		// Token: 0x06010564 RID: 66916 RVA: 0x003F7650 File Offset: 0x003F5850
		private bool DealWithSpectatorWatchToNull(XEntity e)
		{
			bool flag = !XSingleton<XScene>.singleton.bSpectator;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				bool flag2 = XSingleton<XEntityMgr>.singleton.Player.WatchTo == null;
				if (flag2)
				{
					this._unInitEntityList.Add(e.ID);
					result = true;
				}
				else
				{
					bool flag3 = e.ID == XSingleton<XEntityMgr>.singleton.Player.WatchTo.ID && this._unInitEntityList.Count != 0;
					if (flag3)
					{
						this._campEntity = XSingleton<XEntityMgr>.singleton.Player.WatchTo;
						for (int i = 0; i < this._unInitEntityList.Count; i++)
						{
							bool flag4 = this._unInitEntityList[i] == XSingleton<XEntityMgr>.singleton.Player.WatchTo.ID;
							if (!flag4)
							{
								XEntity entityConsiderDeath = XSingleton<XEntityMgr>.singleton.GetEntityConsiderDeath(this._unInitEntityList[i]);
								bool flag5 = entityConsiderDeath != null;
								if (flag5)
								{
									this.MiniMapAdd(entityConsiderDeath);
								}
							}
						}
						this._unInitEntityList.Clear();
					}
					result = false;
				}
			}
			return result;
		}

		// Token: 0x06010565 RID: 66917 RVA: 0x003F7780 File Offset: 0x003F5980
		public void MiniMapAdd(XEntity e)
		{
			bool flag = e == null || e.Attributes == null;
			if (!flag)
			{
				XEntityStatistics.RowData byID = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(e.Attributes.TypeID);
				bool flag2 = byID != null && byID.HideInMiniMap;
				if (!flag2)
				{
					bool flag3 = this.DealWithSpectatorWatchToNull(e);
					if (!flag3)
					{
						bool flag4 = XSingleton<XEntityMgr>.singleton.IsNeutral(e) || e.IsPuppet || e.IsSubstance;
						if (!flag4)
						{
							bool flag5 = !this.m_MiniMapElements.ContainsKey(e.ID);
							if (flag5)
							{
								GameObject gameObject = this.m_MiniMapElementPool.FetchGameObject(false);
								GameObject gameObject2 = gameObject.transform.Find("Circle").gameObject;
								bool flag6 = gameObject2 != null;
								if (flag6)
								{
									gameObject2.SetActive(false);
								}
								IXUISprite ixuisprite = gameObject.GetComponent("XUISprite") as IXUISprite;
								MiniMapElement miniMapElement = new MiniMapElement();
								miniMapElement.notice = null;
								miniMapElement.sp = ixuisprite;
								ixuisprite.SetAlpha(1f);
								bool isPlayer = e.IsPlayer;
								if (isPlayer)
								{
									miniMapElement.sp.SetSprite("smap_1");
									miniMapElement.sp.MakePixelPerfect();
									miniMapElement.sp.spriteDepth = 35;
									gameObject.name = "Player";
								}
								else
								{
									bool flag7 = this.SpecialIsOpponent(this._campEntity, e);
									if (flag7)
									{
										bool isBoss = e.IsBoss;
										if (isBoss)
										{
											miniMapElement.sp.SetSprite("smap_2");
											miniMapElement.sp.MakePixelPerfect();
											miniMapElement.sp.spriteDepth = 32;
											gameObject.name = "Boss";
										}
										else
										{
											bool isElite = e.IsElite;
											if (isElite)
											{
												miniMapElement.sp.SetSprite("smap_3");
												miniMapElement.sp.MakePixelPerfect();
												miniMapElement.sp.spriteDepth = 31;
												gameObject.name = "Elite";
											}
											else
											{
												miniMapElement.sp.SetSprite("smap_6");
												miniMapElement.sp.MakePixelPerfect();
												miniMapElement.sp.spriteDepth = 30;
												gameObject.name = "Enemy";
											}
										}
									}
									else
									{
										bool flag8 = this.SpecialIsAlly(this._campEntity, e);
										if (flag8)
										{
											bool isNpc = e.IsNpc;
											if (isNpc)
											{
												miniMapElement.sp.SetSprite("smap_5");
												miniMapElement.sp.MakePixelPerfect();
												miniMapElement.sp.spriteDepth = 33;
												gameObject.name = "Npc";
											}
											else
											{
												miniMapElement.sp.SetSprite("smap_4");
												miniMapElement.sp.MakePixelPerfect();
												miniMapElement.sp.spriteDepth = 34;
												gameObject.name = "Ally";
											}
										}
										else
										{
											miniMapElement.sp.SetSprite("none");
											miniMapElement.sp.SetAlpha(0f);
										}
									}
								}
								miniMapElement.transform = gameObject.transform;
								this.m_MiniMapElements.Add(e.ID, miniMapElement);
								this.SetupMiniMapElement(e, miniMapElement, false);
							}
							this.RefreshOnMoba(e);
							this.RefreshOnHero(e);
						}
					}
				}
			}
		}

		// Token: 0x06010566 RID: 66918 RVA: 0x003F7AEC File Offset: 0x003F5CEC
		public bool SetMiniMapElement(ulong id, string spriteName, int width = -1, int height = -1)
		{
			MiniMapElement miniMapElement;
			bool flag = this.m_MiniMapElements.TryGetValue(id, out miniMapElement);
			bool result;
			if (flag)
			{
				miniMapElement.sp.SetSprite(spriteName);
				bool flag2 = width == -1 && height == -1;
				if (flag2)
				{
					miniMapElement.sp.MakePixelPerfect();
				}
				else
				{
					miniMapElement.sp.spriteWidth = width;
					miniMapElement.sp.spriteHeight = height;
				}
				result = true;
			}
			else
			{
				result = false;
			}
			return result;
		}

		// Token: 0x06010567 RID: 66919 RVA: 0x003F7B60 File Offset: 0x003F5D60
		public void RefreshOnMoba(XEntity e)
		{
			bool flag = XSingleton<XScene>.singleton.SceneType != SceneType.SCENE_MOBA || e.Attributes == null || XSingleton<XAttributeMgr>.singleton.XPlayerData == null;
			if (!flag)
			{
				bool isRole = e.IsRole;
				if (isRole)
				{
					XMobaBattleDocument specificDocument = XDocuments.GetSpecificDocument<XMobaBattleDocument>(XMobaBattleDocument.uuID);
					MobaMemberData mobaMemberData = null;
					bool flag2 = specificDocument.MyData == null || !specificDocument.MobaData.TryGetValue(e.ID, out mobaMemberData);
					if (!flag2)
					{
						bool flag3 = mobaMemberData.heroID == 0U;
						if (!flag3)
						{
							this.SetHeroMiniMapElement(e.ID, mobaMemberData.heroID, specificDocument.MyData.teamID == mobaMemberData.teamID, true);
						}
					}
				}
			}
		}

		// Token: 0x06010568 RID: 66920 RVA: 0x003F7C14 File Offset: 0x003F5E14
		public void RefreshOnHero(XEntity e)
		{
			bool flag = XSingleton<XScene>.singleton.SceneType != SceneType.SCENE_HEROBATTLE || e.Attributes == null || XSingleton<XAttributeMgr>.singleton.XPlayerData == null;
			if (!flag)
			{
				bool isRole = e.IsRole;
				if (isRole)
				{
					XHeroBattleDocument specificDocument = XDocuments.GetSpecificDocument<XHeroBattleDocument>(XHeroBattleDocument.uuID);
					uint num = 0U;
					bool flag2 = !specificDocument.heroIDIndex.TryGetValue(e.ID, out num);
					if (!flag2)
					{
						bool flag3 = num == 0U;
						if (!flag3)
						{
							this.SetHeroMiniMapElement(e.ID, num, XSingleton<XEntityMgr>.singleton.IsAlly(e), true);
						}
					}
				}
			}
		}

		// Token: 0x06010569 RID: 66921 RVA: 0x003F7CAC File Offset: 0x003F5EAC
		public void SetHeroMiniMapElement(ulong id, uint heroID, bool isMyTeam, bool force = false)
		{
			bool flag = heroID == 0U;
			if (!flag)
			{
				MiniMapElement miniMapElement;
				bool flag2 = this.m_MiniMapElements.TryGetValue(id, out miniMapElement);
				if (flag2)
				{
					bool flag3 = !force && miniMapElement.heroID == heroID;
					if (!flag3)
					{
						XSingleton<XDebug>.singleton.AddGreenLog("SetMiniMap hero ele, uid = ", id.ToString(), ", heroID = ", heroID.ToString(), null, null);
						miniMapElement.heroID = heroID;
						XHeroBattleDocument specificDocument = XDocuments.GetSpecificDocument<XHeroBattleDocument>(XHeroBattleDocument.uuID);
						OverWatchTable.RowData byHeroID = specificDocument.OverWatchReader.GetByHeroID(heroID);
						miniMapElement.sp.SetSprite(byHeroID.MiniMapIcon, "Battle/battledlg2", false);
						miniMapElement.sp.MakePixelPerfect();
						if (isMyTeam)
						{
							IXUISprite sp = miniMapElement.sp;
							int num = this._heroBattleDepth_A;
							this._heroBattleDepth_A = num + 1;
							sp.spriteDepth = num;
						}
						else
						{
							IXUISprite sp2 = miniMapElement.sp;
							int num = this._heroBattleDepth_O;
							this._heroBattleDepth_O = num + 1;
							sp2.spriteDepth = num;
						}
						bool flag4 = id == XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
						if (flag4)
						{
							miniMapElement.sp.spriteDepth = 300;
						}
						Transform transform = miniMapElement.sp.gameObject.transform.Find("Circle");
						bool flag5 = transform != null;
						if (flag5)
						{
							IXUISprite ixuisprite = transform.GetComponent("XUISprite") as IXUISprite;
							bool flag6 = ixuisprite != null;
							if (flag6)
							{
								ixuisprite.SetVisible(true);
								ixuisprite.SetSprite(isMyTeam ? "smhead_o" : "smhead_e");
								if (isMyTeam)
								{
									IXUISprite ixuisprite2 = ixuisprite;
									int num = this._heroBattleDepth_A;
									this._heroBattleDepth_A = num + 1;
									ixuisprite2.spriteDepth = num;
								}
								else
								{
									IXUISprite ixuisprite3 = ixuisprite;
									int num = this._heroBattleDepth_O;
									this._heroBattleDepth_O = num + 1;
									ixuisprite3.spriteDepth = num;
								}
								bool flag7 = id == XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
								if (flag7)
								{
									ixuisprite.spriteDepth = 301;
								}
							}
						}
					}
				}
			}
		}

		// Token: 0x0601056A RID: 66922 RVA: 0x003F7EB0 File Offset: 0x003F60B0
		public void ResetMiniMapAllElement()
		{
			List<XEntity> all = XSingleton<XEntityMgr>.singleton.GetAll();
			for (int i = 0; i < all.Count; i++)
			{
				this.ResetMiniMapElement(all[i].ID);
			}
		}

		// Token: 0x0601056B RID: 66923 RVA: 0x003F7EF4 File Offset: 0x003F60F4
		public bool ResetMiniMapElement(ulong id)
		{
			MiniMapElement miniMapElement;
			bool flag = this.m_MiniMapElements.TryGetValue(id, out miniMapElement);
			bool result;
			if (flag)
			{
				XEntity entityConsiderDeath = XSingleton<XEntityMgr>.singleton.GetEntityConsiderDeath(id);
				bool flag2 = entityConsiderDeath == null;
				if (flag2)
				{
					result = false;
				}
				else
				{
					miniMapElement.sp.SetAlpha(1f);
					bool isPlayer = entityConsiderDeath.IsPlayer;
					if (isPlayer)
					{
						miniMapElement.sp.SetSprite("smap_1");
						miniMapElement.sp.MakePixelPerfect();
						miniMapElement.sp.spriteDepth = 35;
					}
					else
					{
						bool flag3 = this.SpecialIsOpponent(this._campEntity, entityConsiderDeath);
						if (flag3)
						{
							bool isBoss = entityConsiderDeath.IsBoss;
							if (isBoss)
							{
								miniMapElement.sp.SetSprite("smap_2");
								miniMapElement.sp.MakePixelPerfect();
								miniMapElement.sp.spriteDepth = 32;
							}
							else
							{
								bool isElite = entityConsiderDeath.IsElite;
								if (isElite)
								{
									miniMapElement.sp.SetSprite("smap_3");
									miniMapElement.sp.MakePixelPerfect();
									miniMapElement.sp.spriteDepth = 31;
								}
								else
								{
									miniMapElement.sp.SetSprite("smap_6");
									miniMapElement.sp.MakePixelPerfect();
									miniMapElement.sp.spriteDepth = 30;
								}
							}
						}
						else
						{
							bool flag4 = this.SpecialIsAlly(this._campEntity, entityConsiderDeath);
							if (flag4)
							{
								bool isNpc = entityConsiderDeath.IsNpc;
								if (isNpc)
								{
									miniMapElement.sp.SetSprite("smap_5");
									miniMapElement.sp.MakePixelPerfect();
									miniMapElement.sp.spriteDepth = 33;
								}
								else
								{
									miniMapElement.sp.SetSprite("smap_4");
									miniMapElement.sp.MakePixelPerfect();
									miniMapElement.sp.spriteDepth = 34;
								}
							}
							else
							{
								XSingleton<XDebug>.singleton.AddGreenLog("null", null, null, null, null, null);
								miniMapElement.sp.SetAlpha(0f);
							}
						}
					}
					this.RefreshOnMoba(entityConsiderDeath);
					this.RefreshOnHero(entityConsiderDeath);
					result = true;
				}
			}
			else
			{
				result = false;
			}
			return result;
		}

		// Token: 0x0601056C RID: 66924 RVA: 0x003F8108 File Offset: 0x003F6308
		private bool SpecialIsOpponent(XEntity e1, XEntity e2)
		{
			bool flag = XSingleton<XScene>.singleton.bSpectator && XSingleton<XSceneMgr>.singleton.IsPVPScene() && e2.IsRole;
			bool result;
			if (flag)
			{
				XSpectateSceneDocument specificDocument = XDocuments.GetSpecificDocument<XSpectateSceneDocument>(XSpectateSceneDocument.uuID);
				bool flag3;
				bool flag2 = !specificDocument.TryGetEntityIsBlueTeam(e2, out flag3);
				result = (!flag2 && !flag3);
			}
			else
			{
				result = XSingleton<XEntityMgr>.singleton.IsOpponent(e1, e2);
			}
			return result;
		}

		// Token: 0x0601056D RID: 66925 RVA: 0x003F8178 File Offset: 0x003F6378
		private bool SpecialIsAlly(XEntity e1, XEntity e2)
		{
			bool flag = XSingleton<XScene>.singleton.bSpectator && XSingleton<XSceneMgr>.singleton.IsPVPScene() && e2.IsRole;
			bool result;
			if (flag)
			{
				XSpectateSceneDocument specificDocument = XDocuments.GetSpecificDocument<XSpectateSceneDocument>(XSpectateSceneDocument.uuID);
				bool flag3;
				bool flag2 = !specificDocument.TryGetEntityIsBlueTeam(e2, out flag3);
				result = (!flag2 && flag3);
			}
			else
			{
				result = XSingleton<XEntityMgr>.singleton.IsAlly(e1, e2);
			}
			return result;
		}

		// Token: 0x0601056E RID: 66926 RVA: 0x003F81E4 File Offset: 0x003F63E4
		public static void SetMiniMapOpponentStatus(bool hide)
		{
			BattleIndicateHandler._hide_minimap_opponent = hide;
		}

		// Token: 0x0601056F RID: 66927 RVA: 0x003F81F0 File Offset: 0x003F63F0
		public void MiniMapAddDoor(Transform go)
		{
			Transform transform = go.FindChild("Target");
			bool flag = transform != null;
			if (flag)
			{
				GameObject gameObject = this.m_MiniMapElementPool.FetchGameObject(false);
				GameObject gameObject2 = gameObject.transform.Find("Circle").gameObject;
				bool flag2 = gameObject2 != null;
				if (flag2)
				{
					gameObject2.SetActive(false);
				}
				IXUISprite ixuisprite = gameObject.GetComponent("XUISprite") as IXUISprite;
				ixuisprite.SetAlpha(1f);
				MiniMapElement miniMapElement = new MiniMapElement();
				miniMapElement.notice = null;
				miniMapElement.sp = ixuisprite;
				miniMapElement.sp.SetSprite("smap_7");
				miniMapElement.sp.MakePixelPerfect();
				gameObject.name = "Door";
				miniMapElement.transform = go;
				this.m_MiniMapDoor.Add(miniMapElement);
				this.SetupMiniMapStatic(miniMapElement);
			}
		}

		// Token: 0x06010570 RID: 66928 RVA: 0x000FEEFC File Offset: 0x000FD0FC
		public void OnMonsterDie(XEntity e)
		{
		}

		// Token: 0x06010571 RID: 66929 RVA: 0x003F82D4 File Offset: 0x003F64D4
		public void MiniMapDel(ulong uid)
		{
			MiniMapElement miniMapElement;
			bool flag = this.m_MiniMapElements.TryGetValue(uid, out miniMapElement);
			if (flag)
			{
				this.m_MiniMapElements.Remove(uid);
				this.DestroyFx(miniMapElement.notice);
				miniMapElement.notice = null;
				this.m_MiniMapElementPool.ReturnInstance(miniMapElement.sp.gameObject, false);
			}
		}

		// Token: 0x06010572 RID: 66930 RVA: 0x003F8330 File Offset: 0x003F6530
		public void MiniMapDel(XEntity e)
		{
			bool flag = XSingleton<XEntityMgr>.singleton.IsAlly(e);
			if (!flag)
			{
				MiniMapElement miniMapElement;
				bool flag2 = this.m_MiniMapElements.TryGetValue(e.ID, out miniMapElement);
				if (flag2)
				{
					this.m_MiniMapElements.Remove(e.ID);
					this.DestroyFx(miniMapElement.notice);
					miniMapElement.notice = null;
					this.m_MiniMapElementPool.ReturnInstance(miniMapElement.sp.gameObject, false);
				}
			}
		}

		// Token: 0x06010573 RID: 66931 RVA: 0x003F83A8 File Offset: 0x003F65A8
		public void MiniMapNoticeAdd(XEntity e)
		{
			MiniMapElement element;
			bool flag = this.m_MiniMapElements.TryGetValue(e.ID, out element);
			if (flag)
			{
				this.CreateAndPlayFxFxFirework(element);
			}
		}

		// Token: 0x06010574 RID: 66932 RVA: 0x003F83D8 File Offset: 0x003F65D8
		public void MiniMapBuffAdd(XLevelDoodad doo)
		{
			BuffTable.RowData buffData = XSingleton<XBuffTemplateManager>.singleton.GetBuffData((int)doo.id, 1);
			bool flag = buffData == null;
			if (!flag)
			{
				bool flag2 = string.IsNullOrEmpty(buffData.MiniMapIcon);
				if (!flag2)
				{
					bool flag3 = !this.m_MiniMapDoodadDic.ContainsKey((ulong)doo.index);
					if (flag3)
					{
						GameObject gameObject = this.m_MiniMapElementPool.FetchGameObject(false);
						GameObject gameObject2 = gameObject.transform.Find("Circle").gameObject;
						bool flag4 = gameObject2 != null;
						if (flag4)
						{
							gameObject2.SetActive(false);
						}
						IXUISprite ixuisprite = gameObject.GetComponent("XUISprite") as IXUISprite;
						MiniMapElement miniMapElement = new MiniMapElement();
						miniMapElement.notice = null;
						miniMapElement.sp = ixuisprite;
						ixuisprite.SetAlpha(1f);
						miniMapElement.sp.SetSprite(buffData.MiniMapIcon);
						miniMapElement.sp.MakePixelPerfect();
						miniMapElement.sp.spriteDepth = 36;
						gameObject.name = "Buff";
						miniMapElement.transform = doo.doodad.transform;
						this.m_MiniMapBuff.Add(miniMapElement);
						this.m_MiniMapDoodadDic.Add((ulong)doo.index, miniMapElement);
						this.SetupMiniMapStatic(miniMapElement);
					}
				}
			}
		}

		// Token: 0x06010575 RID: 66933 RVA: 0x003F8528 File Offset: 0x003F6728
		public void MiniMapBuffDel(XLevelDoodad doo)
		{
			MiniMapElement miniMapElement;
			bool flag = this.m_MiniMapDoodadDic.TryGetValue((ulong)doo.index, out miniMapElement);
			if (flag)
			{
				this.m_MiniMapBuff.Remove(miniMapElement);
				this.m_MiniMapDoodadDic.Remove((ulong)doo.index);
				this.DestroyFx(miniMapElement.notice);
				miniMapElement.notice = null;
				this.m_MiniMapElementPool.ReturnInstance(miniMapElement.sp.gameObject, false);
			}
		}

		// Token: 0x06010576 RID: 66934 RVA: 0x003F859C File Offset: 0x003F679C
		public uint MiniMapFxAdd(Vector3 pos, string fx)
		{
			GameObject gameObject = this.m_MiniMapElementPool.FetchGameObject(false);
			GameObject gameObject2 = gameObject.transform.Find("Circle").gameObject;
			bool flag = gameObject2 != null;
			if (flag)
			{
				gameObject2.SetActive(false);
			}
			IXUISprite ixuisprite = gameObject.GetComponent("XUISprite") as IXUISprite;
			MiniMapElement miniMapElement = new MiniMapElement();
			miniMapElement.notice = XSingleton<XFxMgr>.singleton.CreateFx(fx, null, true);
			bool flag2 = miniMapElement.notice != null;
			if (flag2)
			{
				miniMapElement.notice.Play(ixuisprite.transform, Vector3.zero, Vector3.one, 1f, true, false);
				XSingleton<XGameUI>.singleton.m_uiTool.MarkParentAsChanged(ixuisprite.gameObject);
			}
			miniMapElement.sp = ixuisprite;
			ixuisprite.SetAlpha(1f);
			miniMapElement.pos = pos;
			miniMapElement.sp.SetSprite("");
			gameObject.name = "Fx";
			miniMapElement.transform = null;
			this.m_MiniMapFxToken += 1U;
			this.m_MiniMapFx.Add(miniMapElement);
			this.m_MiniMapFxDic.Add((ulong)this.m_MiniMapFxToken, miniMapElement);
			this.SetupMiniMapFxStatic(miniMapElement);
			return this.m_MiniMapFxToken;
		}

		// Token: 0x06010577 RID: 66935 RVA: 0x003F86D8 File Offset: 0x003F68D8
		public void MiniMapFxDel(uint token)
		{
			MiniMapElement miniMapElement;
			bool flag = this.m_MiniMapFxDic.TryGetValue((ulong)token, out miniMapElement);
			if (flag)
			{
				this.m_MiniMapFx.Remove(miniMapElement);
				this.m_MiniMapFxDic.Remove((ulong)token);
				this.DestroyFx(miniMapElement.notice);
				miniMapElement.notice = null;
				this.m_MiniMapElementPool.ReturnInstance(miniMapElement.sp.gameObject, false);
			}
		}

		// Token: 0x06010578 RID: 66936 RVA: 0x003F8744 File Offset: 0x003F6944
		public uint MiniMapPicAdd(Vector3 pos, string pic)
		{
			GameObject gameObject = this.m_MiniMapElementPool.FetchGameObject(false);
			GameObject gameObject2 = gameObject.transform.Find("Circle").gameObject;
			bool flag = gameObject2 != null;
			if (flag)
			{
				gameObject2.SetActive(false);
			}
			IXUISprite ixuisprite = gameObject.GetComponent("XUISprite") as IXUISprite;
			MiniMapElement miniMapElement = new MiniMapElement();
			miniMapElement.notice = null;
			miniMapElement.sp = ixuisprite;
			ixuisprite.SetAlpha(1f);
			miniMapElement.pos = pos;
			miniMapElement.sp.SetSprite(pic);
			miniMapElement.sp.MakePixelPerfect();
			miniMapElement.sp.transform.localEulerAngles = -this.m_MiniMapRotation.transform.eulerAngles;
			miniMapElement.sp.spriteDepth = 36;
			gameObject.name = "Pic";
			miniMapElement.transform = null;
			this.m_MiniMapPicToken += 1U;
			this.m_MiniMapPic.Add(miniMapElement);
			this.m_MiniMapPicDic.Add((ulong)this.m_MiniMapPicToken, miniMapElement);
			this.SetupMiniMapPicStatic(miniMapElement);
			return this.m_MiniMapPicToken;
		}

		// Token: 0x06010579 RID: 66937 RVA: 0x003F8868 File Offset: 0x003F6A68
		public void MiniMapPicDel(uint token)
		{
			MiniMapElement miniMapElement;
			bool flag = this.m_MiniMapPicDic.TryGetValue((ulong)token, out miniMapElement);
			if (flag)
			{
				this.m_MiniMapPic.Remove(miniMapElement);
				this.m_MiniMapPicDic.Remove((ulong)token);
				this.m_MiniMapElementPool.ReturnInstance(miniMapElement.sp.gameObject, false);
			}
		}

		// Token: 0x0601057A RID: 66938 RVA: 0x003F88C0 File Offset: 0x003F6AC0
		public void CreateAndPlayFxFxFirework(MiniMapElement element)
		{
			this.DestroyFx(element.notice);
			element.notice = null;
			element.notice = XSingleton<XFxMgr>.singleton.CreateFx("Effects/FX_Particle/UIfx/UI_xdtts", null, true);
			element.notice.Play(element.sp.transform, Vector3.zero, Vector3.one, 1f, true, false);
			XSingleton<XGameUI>.singleton.m_uiTool.MarkParentAsChanged(element.sp.gameObject);
		}

		// Token: 0x0601057B RID: 66939 RVA: 0x003F893C File Offset: 0x003F6B3C
		private void DestroyFx(XFx fx)
		{
			bool flag = fx == null;
			if (!flag)
			{
				XSingleton<XFxMgr>.singleton.DestroyFx(fx, true);
			}
		}

		// Token: 0x0601057C RID: 66940 RVA: 0x003F8964 File Offset: 0x003F6B64
		public void MiniMapNoticeDel(XEntity e)
		{
			MiniMapElement miniMapElement;
			bool flag = this.m_MiniMapElements.TryGetValue(e.ID, out miniMapElement);
			if (flag)
			{
				this.DestroyFx(miniMapElement.notice);
				miniMapElement.notice = null;
			}
		}

		// Token: 0x0601057D RID: 66941 RVA: 0x003F89A0 File Offset: 0x003F6BA0
		public void ShowDirection(Transform target)
		{
			this.m_CachedDirectionTarget = target;
			bool flag = !XSingleton<XScene>.singleton.bSpectator;
			if (flag)
			{
				this.m_Direction.localPosition = this.m_DirectPos;
			}
		}

		// Token: 0x0601057E RID: 66942 RVA: 0x003F89D8 File Offset: 0x003F6BD8
		public void UpdateDirection()
		{
			bool flag = this.m_CachedDirectionTarget != null;
			if (flag)
			{
				XPlayer player = XSingleton<XEntityMgr>.singleton.Player;
				Camera unityCamera = XSingleton<XScene>.singleton.GameCamera.UnityCamera;
				Vector3 position = player.EngineObject.Position;
				Vector3 vector;
				vector = new Vector3(this.m_CachedDirectionTarget.transform.position.x, 0f, this.m_CachedDirectionTarget.transform.position.z);
				Vector3 vector2;
				vector2 = new Vector3(position.x, 0f, position.z);
				Vector3 vector3 = vector - vector2;
				Vector3 vector4;
				vector4 = new Vector3(unityCamera.transform.forward.x, 0f, unityCamera.transform.forward.z);
				float sqrMagnitude = vector3.sqrMagnitude;
				float num = Vector3.Angle(vector4, vector3);
				bool flag2 = XSingleton<XCommon>.singleton.Clockwise(vector4, vector3);
				if (flag2)
				{
					this.m_Direction.transform.localRotation = Quaternion.AngleAxis(-num, Vector3.forward);
				}
				else
				{
					this.m_Direction.transform.localRotation = Quaternion.AngleAxis(num, Vector3.forward);
				}
				bool flag3 = sqrMagnitude < 50f;
				if (flag3)
				{
					this.m_Direction.localPosition = XGameUI.Far_Far_Away;
					this.m_CachedDirectionTarget = null;
				}
			}
		}

		// Token: 0x0601057F RID: 66943 RVA: 0x003F8B35 File Offset: 0x003F6D35
		public void ClearTeamIndicate()
		{
			this.m_EntityIndicates.Clear();
			this.m_TeamIndicatePool.ReturnAll(false);
			this.m_IndicatesList.Clear();
		}

		// Token: 0x06010580 RID: 66944 RVA: 0x003F8B5D File Offset: 0x003F6D5D
		public void ChangeWatchToEntity(XEntity e)
		{
			this._campEntity = e;
		}

		// Token: 0x040075AA RID: 30122
		public XUIPool m_TeamIndicatePool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);

		// Token: 0x040075AB RID: 30123
		public Transform m_Direction;

		// Token: 0x040075AC RID: 30124
		private Vector3 m_DirectPos;

		// Token: 0x040075AD RID: 30125
		private Transform m_CachedDirectionTarget;

		// Token: 0x040075AE RID: 30126
		private List<BattleIndicator> m_IndicatesList = new List<BattleIndicator>();

		// Token: 0x040075AF RID: 30127
		private Dictionary<ulong, BattleIndicator> m_EntityIndicates = new Dictionary<ulong, BattleIndicator>();

		// Token: 0x040075B0 RID: 30128
		private float _Half_H_Fov;

		// Token: 0x040075B1 RID: 30129
		private float _tan_half_H_fov;

		// Token: 0x040075B2 RID: 30130
		private float _Half_V_Fov;

		// Token: 0x040075B3 RID: 30131
		private float _tan_half_V_fov;

		// Token: 0x040075B4 RID: 30132
		private float _sqr_tan_half_V_fov;

		// Token: 0x040075B5 RID: 30133
		private Transform m_MiniMapRotation;

		// Token: 0x040075B6 RID: 30134
		private IXUITexture m_MiniMap;

		// Token: 0x040075B7 RID: 30135
		private Transform m_MiniMapCamera;

		// Token: 0x040075B8 RID: 30136
		private XUIPool m_MiniMapElementPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);

		// Token: 0x040075B9 RID: 30137
		private Dictionary<ulong, MiniMapElement> m_MiniMapElements = new Dictionary<ulong, MiniMapElement>();

		// Token: 0x040075BA RID: 30138
		private List<MiniMapElement> m_MiniMapDoor = new List<MiniMapElement>();

		// Token: 0x040075BB RID: 30139
		private List<MiniMapElement> m_MiniMapBuff = new List<MiniMapElement>();

		// Token: 0x040075BC RID: 30140
		private Dictionary<ulong, MiniMapElement> m_MiniMapDoodadDic = new Dictionary<ulong, MiniMapElement>();

		// Token: 0x040075BD RID: 30141
		private List<MiniMapElement> m_MiniMapFx = new List<MiniMapElement>();

		// Token: 0x040075BE RID: 30142
		private Dictionary<ulong, MiniMapElement> m_MiniMapFxDic = new Dictionary<ulong, MiniMapElement>();

		// Token: 0x040075BF RID: 30143
		private List<MiniMapElement> m_MiniMapPic = new List<MiniMapElement>();

		// Token: 0x040075C0 RID: 30144
		private Dictionary<ulong, MiniMapElement> m_MiniMapPicDic = new Dictionary<ulong, MiniMapElement>();

		// Token: 0x040075C1 RID: 30145
		private uint m_MiniMapFxToken = 0U;

		// Token: 0x040075C2 RID: 30146
		private uint m_MiniMapPicToken = 0U;

		// Token: 0x040075C3 RID: 30147
		private float MiniMapScale;

		// Token: 0x040075C4 RID: 30148
		private bool _staticMap;

		// Token: 0x040075C5 RID: 30149
		private Vector3 _referencePos;

		// Token: 0x040075C6 RID: 30150
		private Vector2 _outSize = Vector2.one;

		// Token: 0x040075C7 RID: 30151
		private int _heroBattleDepth_O;

		// Token: 0x040075C8 RID: 30152
		private int _heroBattleDepth_A;

		// Token: 0x040075C9 RID: 30153
		private static bool _hide_minimap_opponent;

		// Token: 0x040075CA RID: 30154
		private XEntity _campEntity;

		// Token: 0x040075CB RID: 30155
		private List<ulong> _unInitEntityList = new List<ulong>();

		// Token: 0x040075CC RID: 30156
		private Vector2 MiniMapSize;

		// Token: 0x040075CD RID: 30157
		private readonly float BASESIZE = 65f;

		// Token: 0x040075CE RID: 30158
		private Vector2 MapSizeInTable;

		// Token: 0x040075CF RID: 30159
		private int MaxDisplayNum = 0;

		// Token: 0x040075D0 RID: 30160
		private List<int> m_ShouldShowEnemyIndex = new List<int>();

		// Token: 0x040075D1 RID: 30161
		private HashSet<ulong> m_ValidSet = new HashSet<ulong>();
	}
}
